let loop_count = ref 0;;

let rec tarai x y z =
  loop_count := !loop_count + 1;
  if (y < x) then
    tarai (tarai (x-1) y z) (tarai (y-1) z x) (tarai (z-1) x y)
  else
    y;;

print_int (tarai 12 6 0);;
print_string "\n";;
print_int !loop_count;;
print_string "\n";;
